﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace RiskMan.DataClass.AlfaDirectFolder
{

    /// <summary>
    /// ТАБЛИЦА «FIN_INFO» - КОТИРОВКИ
    /// Ключевое поле: paper_no
    /// </summary>
    public class FinInfo : INotifyPropertyChanged
    {
        #region Private
        private int _paperNo;
        private double _openPrice;
        private double _lastPrice;
        private double _avgPrice;
        private double _closePrice;
        private double _change;
        private double _maxDeal;
        private double _minDeal;
        private double _sumQty;
        private double _sumVolume;
        private int _noDeal;
        private int _sellQty;
        private int _buyQty;
        private double _sell;
        private double _buy;
        private DateTime _lastUpdateTime;
        private DateTime _lastUpdateDate;
        private double _highBid;
        private double _lowOffer;
        private double _prevPrice;
        private double _pChange;
        private double _bidOffer;
        private int _status;
        private double _lastChange;
        private string _pCode;
        private string _placeCode;
        private string _placeName;
        private string _currCode;
        private string _tsPCode;
        private string _boardCode;
        private int _lotSize;
        private int _decimals;
        private double _priceStep;
        private string _ansiName;
        private string _boardName;
        private double _goBuy;
        private double _goSell; 
        #endregion

        #region Public

        /// <summary>
        /// Цифровой код финансового инструмента.
        /// </summary>
        public int PaperNo
        {
            get { return _paperNo; }
            set
            {
                if (_paperNo != value)
                    _paperNo = value;

                RaisePropertyChanged("PaperNo");
            }
        }
        /// <summary>
        /// Цена открытия.
        /// </summary>
        public double OpenPrice
        {
            get { return _openPrice; }
            set
            {
                if (_openPrice != value)
                    _openPrice = value;

                RaisePropertyChanged("OpenPrice");
            }
        }
        /// <summary>
        /// Последняя цена.
        /// </summary>
        public double LastPrice
        {
            get { return _lastPrice; }
            set
            {
                if (_lastPrice != value)
                    _lastPrice = value;

                RaisePropertyChanged("LastPrice");
            }
        }
        /// <summary>
        /// Средняя цена.
        /// </summary>
        public double AvgPrice
        {
            get { return _avgPrice; }
            set
            {
                if (_avgPrice != value)
                    _avgPrice = value;

                RaisePropertyChanged("AvgPrice");
            }
        }
        /// <summary>
        /// Цена закрытия.
        /// </summary>
        public double ClosePrice
        {
            get { return _closePrice; }
            set
            {
                if (_closePrice != value)
                    _closePrice = value;

                RaisePropertyChanged("ClosePrice");
            }
        }
        /// <summary>
        /// Абсолютное изменение.
        /// </summary>
        public double Change
        {
            get { return _change; }
            set
            {
                if (_change != value)
                    _change = value;

                RaisePropertyChanged("Change");
            }
        }
        /// <summary>
        /// Максимальная цена сделки.
        /// </summary>
        public double MaxDeal
        {
            get { return _maxDeal; }
            set
            {
                if (_maxDeal != value)
                    _maxDeal = value;

                RaisePropertyChanged("MaxDeal");
            }
        }
        /// <summary>
        /// Минимальная цена сделки.
        /// </summary>
        public double MinDeal
        {
            get { return _minDeal; }
            set
            {
                if (_minDeal != value)
                    _minDeal = value;

                RaisePropertyChanged("MinDeal");
            }
        }
        /// <summary>
        /// Суммарное количество в сделках.
        /// </summary>
        public double SumQty
        {
            get { return _sumQty; }
            set
            {
                if (_sumQty != value)
                    _sumQty = value;

                RaisePropertyChanged("SumQty");
            }
        }
        /// <summary>
        /// Суммарный объем сделок..
        /// </summary>
        public double SumVolume
        {
            get { return _sumVolume; }
            set
            {
                if (_sumVolume != value)
                    _sumVolume = value;

                RaisePropertyChanged("SumVolume");
            }
        }
        /// <summary>
        /// Количество сделок.
        /// </summary>
        public int NoDeal
        {
            get { return _noDeal; }
            set
            {
                if (_noDeal != value)
                    _noDeal = value;

                RaisePropertyChanged("NoDeal");
            }
        }
        /// <summary>
        /// Количество в лучшей продаже.
        /// </summary>
        public int SellQty
        {
            get { return _sellQty; }
            set
            {
                if (_sellQty != value)
                    _sellQty = value;

                RaisePropertyChanged("SellQty");
            }
        }
        /// <summary>
        /// Количество в лучшей покупке.
        /// </summary>
        public int BuyQty
        {
            get { return _buyQty; }
            set
            {
                if (_buyQty != value)
                    _buyQty = value;

                RaisePropertyChanged("BuyQty");
            }
        }
        /// <summary>
        /// Цена лучшей продажи.
        /// </summary>
        public double Sell
        {
            get { return _sell; }
            set
            {
                if (_sell != value)
                    _sell = value;

                RaisePropertyChanged("Sell");
            }
        }
        /// <summary>
        /// Цена лучшей покупки.
        /// </summary>
        public double Buy
        {
            get { return _buy; }
            set
            {
                if (_buy != value)
                    _buy = value;

                RaisePropertyChanged("Buy");
            }
        }
        /// <summary>
        /// Время последнего обновления..
        /// </summary>
        public DateTime LastUpdateTime
        {
            get { return _lastUpdateTime; }
            set
            {
                if (_lastUpdateTime != value)
                    _lastUpdateTime = value;

                RaisePropertyChanged("LastUpdateTime");
            }
        }
        /// <summary>
        /// Дата последнего обновления.
        /// </summary>
        public DateTime LastUpdateDate
        {
            get { return _lastUpdateDate; }
            set
            {
                if (_lastUpdateDate != value)
                    _lastUpdateDate = value;

                RaisePropertyChanged("LastUpdateDate");
            }
        }
        /// <summary>
        /// Максимальный спрос.
        /// </summary>
        public double HighBid
        {
            get { return _highBid; }
            set
            {
                if (_highBid != value)
                    _highBid = value;

                RaisePropertyChanged("HighBid");
            }
        }
        /// <summary>
        /// Минимальное предложение.
        /// </summary>
        public double LowOffer
        {
            get { return _lowOffer; }
            set
            {
                if (_lowOffer != value)
                    _lowOffer = value;

                RaisePropertyChanged("LowOffer");
            }
        }
        /// <summary>
        /// Цена предыдущей сделки.
        /// </summary>
        public double PrevPrice
        {
            get { return _prevPrice; }
            set
            {
                if (_prevPrice != value)
                    _prevPrice = value;

                RaisePropertyChanged("PrevPrice");
            }
        }
        /// <summary>
        /// % Изменение.
        /// </summary>
        public double PChange
        {
            get { return _pChange; }
            set
            {
                if (_pChange != value)
                    _pChange = value;

                RaisePropertyChanged("PChange");
            }
        }
        /// <summary>
        /// Спрос/предложение.
        /// </summary>
        public double BidOffer
        {
            get { return _bidOffer; }
            set
            {
                if (_bidOffer != value)
                    _bidOffer = value;

                RaisePropertyChanged("BidOffer");
            }
        }
        /// <summary>
        /// Статус торгов.
        /// </summary>
        public int Status
        {
            get { return _status; }
            set
            {
                if (_status != value)
                    _status = value;

                RaisePropertyChanged("Status");
            }
        }
        /// <summary>
        /// Изменение последней цены.
        /// </summary>
        public double LastChange
        {
            get { return _lastChange; }
            set
            {
                if (_lastChange != value)
                    _lastChange = value;

                RaisePropertyChanged("LastChange");
            }
        }
        /// <summary>
        /// Код актива.
        /// </summary>
        public string PCode
        {
            get { return _pCode; }
            set
            {
                if (_pCode != value)
                    _pCode = value;

                RaisePropertyChanged("PCode");
            }
        }
        /// <summary>
        /// Код рынка.
        /// </summary>
        public string PlaceCode
        {
            get { return _placeCode; }
            set
            {
                if (_placeCode != value)
                    _placeCode = value;

                RaisePropertyChanged("PlaceCode");
            }
        }
        /// <summary>
        /// Название рынка.
        /// </summary>
        public string PlaceName
        {
            get { return _placeName; }
            set
            {
                if (_placeName != value)
                    _placeName = value;

                RaisePropertyChanged("PlaceName");
            }
        }
        /// <summary>
        /// Код валюты котировок.
        /// </summary>
        public string CurrCode
        {
            get { return _currCode; }
            set
            {
                if (_currCode != value)
                    _currCode = value;

                RaisePropertyChanged("CurrCode");
            }
        }
        /// <summary>
        /// Торговый код инструмента.
        /// </summary>
        public string TsPCode
        {
            get { return _tsPCode; }
            set
            {
                if (_tsPCode != value)
                    _tsPCode = value;

                RaisePropertyChanged("TsPCode");
            }
        }
        /// <summary>
        /// Код торгового раздела.
        /// </summary>
        public string BoardCode
        {
            get { return _boardCode; }
            set
            {
                if (_boardCode != value)
                    _boardCode = value;

                RaisePropertyChanged("BoardCode");
            }
        }
        /// <summary>
        /// Размер лота.
        /// </summary>
        public int LotSize
        {
            get { return _lotSize; }
            set
            {
                if (_lotSize != value)
                    _lotSize = value;

                RaisePropertyChanged("LotSize");
            }
        }
        /// <summary>
        /// Количество знаков в дробной части.
        /// </summary>
        public int Decimals
        {
            get { return _decimals; }
            set
            {
                if (_decimals != value)
                    _decimals = value;

                RaisePropertyChanged("Decimals");
            }
        }
        /// <summary>
        /// Шаг цены.
        /// </summary>
        public double PriceStep
        {
            get { return _priceStep; }
            set
            {
                if (_priceStep != value)
                    _priceStep = value;

                RaisePropertyChanged("PriceStep");
            }
        }
        /// <summary>
        /// Короткое название.
        /// </summary>
        public string AnsiName
        {
            get { return _ansiName; }
            set
            {
                if (_ansiName != value)
                    _ansiName = value;

                RaisePropertyChanged("AnsiName");
            }
        }
        /// <summary>
        /// Название торгового раздела.
        /// </summary>
        public string BoardName
        {
            get { return _boardName; }
            set
            {
                if (_boardName != value)
                    _boardName = value;

                RaisePropertyChanged("BoardName");
            }
        }
        /// <summary>
        /// Гарантийное обеспечение покупки.
        /// </summary>
        public double GoBuy
        {
            get { return _goBuy; }
            set
            {
                if (_goBuy != value)
                    _goBuy = value;

                RaisePropertyChanged("GoBuy");
            }
        }
        /// <summary>
        /// Гарантийное обеспечение продажи.
        /// </summary>
        public double GoSell
        {
            get { return _goSell; }
            set
            {
                if (_goSell != value)
                    _goSell = value;

                RaisePropertyChanged("GoSell");
            }
        } 
        #endregion

        #region event PropertyChangedEventHandler

        public event PropertyChangedEventHandler PropertyChanged;

        protected void RaisePropertyChanged(string propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        #endregion
    }
}
